package com.yanqu.road.server.cmd.activity.peakseacraft;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.PeakSeacraftProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.peakseacraft.PeakSeacraftMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = CrossProtocol.C_PEAK_SEACRAFT_GET_DONATION_SHIP_DETAIL, desc = "海上争霸 南海丝路 获取捐献详情")
public class CrossPeakSeacraftGetDonationShipDetailCmd extends CrossUnionCommand {
    long userId;
    int activityId;
    String unionId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        PeakSeacraftProto.PeakSeacraftGetDonationShipDetailGameToCrossMsg msg = PeakSeacraftProto.PeakSeacraftGetDonationShipDetailGameToCrossMsg.parseFrom(packet.getBytes());
        userId = packet.getPlayerId();
        activityId = msg.getActivityId();
        unionId = msg.getUnionId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId, YanQuMessageUtils.buildMessage(ClientProtocol.U_PEAK_SEACRAFT_GET_DONATION_SHIP_DETAIL,
                PeakSeacraftMgr.getDonationShipDetail(activityId, userId, unionId)));
    }

    @Override
    public void sendData() {

    }
}
